package com.betterjr.modules.risk.loan;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.dubbo.config.annotation.Reference;
import com.betterjr.common.web.ControllerExceptionHandler;
import com.betterjr.common.web.Servlets;
import com.betterjr.common.web.ControllerExceptionHandler.ExceptionHandler;

@Controller
@RequestMapping("/Scf/Risk/Loan/LoanProjectBank")
public class LoanProjectBankController {

    private static final Logger logger = LoggerFactory.getLogger(LoanProjectBankController.class);

    @Reference(interfaceClass = ILoanProjectBankService.class)
    private ILoanProjectBankService bankService;

    /**
     * 
     * @Title: queryBanks 
     * @Description: 查询银行信息
     * @param request
     * @param loanId
     * @param type
     * @return TODO(说明)
     * @throws 
     * @author xuyp
     * @date 2018年7月2日 上午11:13:56
     */
    @RequestMapping(value = "/queryBanks", method = RequestMethod.POST)
    public @ResponseBody String queryBanks(final HttpServletRequest request, Long loanId, String type) {
        Map<String, Object> anMap = Servlets.getParametersStartingWith(request, "");
        logger.info("查询银行信息,入参:" + anMap.toString());
        return ControllerExceptionHandler.exec(new ExceptionHandler() {
            @Override
            public String handle() {
                return bankService.webQueryBanks(loanId, type);
            }
        }, "查询银行信息失败", logger);
    }
}
